package com.gxwy.shenzhou;

public class JiLuResponse implements StringHandler {

	private String jyrq;
	private String jysj;
	private String jyls;
	private String zhdh;
	private String zhmc;
	private String ccy;
	private String jdbj;
	private String xzbz;
	private String jyje;
	private String zhye;
	private String zysm;
	
	public static final int JYRQ_FLAG = 2;
	public static final int JYSJ_FLAG = 2;
	public static final int JYLS_FLAG = 2;
	public static final int ZHDH_FLAG = 2;
	public static final int ZHMC_FLAG = 2;
	public static final int CCY_FLAG = 2;
	public static final int JDBJ_FLAG = 2;
	public static final int XZBZ_FLAG = 2;
	public static final int JYJE_FLAG = 3;
	public static final int ZHYE_FLAG = 3;
	public static final int ZYSM_FLAG = 2;
	
	public static final int JYRQ_LEN = 8;
	public static final int JYSJ_LEN = 6;
	public static final int JYLS_LEN = 10;
	public static final int ZHDH_LEN = 32;
	public static final int ZHMC_LEN = 60;
	public static final int CCY_LEN = 2;
	public static final int JDBJ_LEN = 1;
	public static final int XZBZ_LEN = 1;
	public static final int JYJE_LEN = 15;
	public static final int ZHYE_LEN = 15;
	public static final int ZYSM_LEN = 30;
	
	public static final int TOTAL_LEN = JYRQ_LEN+JYSJ_LEN+JYLS_LEN+ZHDH_LEN+ZHMC_LEN+CCY_LEN+JDBJ_LEN+XZBZ_LEN+JYJE_LEN+ZHYE_LEN+ZYSM_LEN;
	private int reallen = 0;
	public String getJyrq() {
		return jyrq;
	}
	public void setJyrq(String jyrq) throws Exception{
		if(jyrq==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(jyrq.getBytes("gbk").length<JYRQ_LEN){
			this.jyrq = Supply.supply(jyrq,JYRQ_FLAG,JYRQ_LEN);
		}else if(jyrq.getBytes("gbk").length>JYRQ_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.jyrq = jyrq;			
		}
	}
	
	public String getJysj() {
		return jysj;
	}
	public void setJysj(String jysj) throws Exception{
		if(jysj==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(jysj.getBytes("gbk").length<JYSJ_LEN){
			this.jysj = Supply.supply(jysj,JYSJ_FLAG,JYSJ_LEN);
		}else if(jysj.getBytes("gbk").length>JYSJ_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.jysj = jysj;			
		}
	}
	
	public String getJyls() {
		return jyls;
	}
	public void setJyls(String jyls) throws Exception{
		if(jyls==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(jyls.getBytes("gbk").length<JYLS_LEN){
			this.jyls = Supply.supply(jyls,JYLS_FLAG,JYLS_LEN);
		}else if(jyls.getBytes("gbk").length>JYLS_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.jyls = jyls;			
		}
	}
	
	public String getZhdh() {
		return zhdh;
	}
	public void setZhdh(String zhdh) throws Exception{
		if(zhdh==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(zhdh.getBytes("gbk").length<ZHDH_LEN){
			this.zhdh = Supply.supply(zhdh,ZHDH_FLAG,ZHDH_LEN);
		}else if(zhdh.getBytes("gbk").length>ZHDH_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.zhdh = zhdh;			
		}
	}
	
	public String getZhmc() {
		return zhmc;
	}
	public void setZhmc(String zhmc) throws Exception{
		if(zhmc==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(zhmc.getBytes("gbk").length<ZHMC_LEN){
			this.zhmc = Supply.supply(zhmc,ZHMC_FLAG,ZHMC_LEN);
		}else if(zhmc.getBytes("gbk").length>ZHMC_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.zhmc = zhmc;			
		}
	}
	
	public String getCcy() {
		return ccy;
	}
	public void setCcy(String ccy) throws Exception{
		if(ccy==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(ccy.getBytes("gbk").length<CCY_LEN){
			this.ccy = Supply.supply(ccy,CCY_FLAG,CCY_LEN);
		}else if(ccy.getBytes("gbk").length>CCY_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.ccy = ccy;			
		}
	}
	
	public String getJdbj() {
		return jdbj;
	}
	public void setJdbj(String jdbj) throws Exception{
		if(jdbj==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(jdbj.getBytes("gbk").length<JDBJ_LEN){
			this.jdbj = Supply.supply(jdbj,JDBJ_FLAG,JDBJ_LEN);
		}else if(jdbj.getBytes("gbk").length>JDBJ_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.jdbj = jdbj;			
		}
	}
	
	public String getXzbz() {
		return xzbz;
	}
	public void setXzbz(String xzbz) throws Exception{
		if(xzbz==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(xzbz.getBytes("gbk").length<XZBZ_LEN){
			this.xzbz= Supply.supply(xzbz,XZBZ_FLAG,XZBZ_LEN);
		}else if(xzbz.getBytes("gbk").length>XZBZ_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.xzbz = xzbz;			
		}
	}

	public String getJyje() {
		return jyje;
	}
	public void setJyje(String jyje) throws Exception{
		if(jyje==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(jyje.getBytes("gbk").length<JYJE_LEN){
			this.jyje= Supply.supply(jyje,JYJE_FLAG,JYJE_LEN);
		}else if(jyje.getBytes("gbk").length>JYJE_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.jyje = jyje;			
		}
	}

	public String getZhye() {
		return zhye;
	}
	public void setZhye(String zhye) throws Exception{
		if(zhye==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(zhye.getBytes("gbk").length<ZHYE_LEN){
			this.zhye= Supply.supply(zhye,ZHYE_FLAG,ZHYE_LEN);
		}else if(zhye.getBytes("gbk").length>ZHYE_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.zhye = zhye;			
		}
	}

	public String getZysm() {
		return zysm;
	}
	public void setZysm(String zysm) throws Exception{
		if(zysm==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(zysm.getBytes("gbk").length<ZYSM_LEN){
			this.zysm= Supply.supply(zysm,ZYSM_FLAG,ZYSM_LEN);
		}else if(zysm.getBytes("gbk").length>ZYSM_LEN){
			Exception e=new Exception("Too Long");
			throw e;
		}else{
			this.zysm = zysm;			
		}
	}
	
	public String build() throws Exception {
		if(this.getJyrq()==null){
			this.setJyrq("");
		}
		if(this.getJysj()==null){
			this.setJysj("");
		}
		if(this.getJyls()==null){
			this.setJyls("");
		}
		if(this.getZhdh()==null){
			this.setZhdh("");
		}
		if(this.getZhmc()==null){
			this.setZhmc("");
		}
		if(this.getCcy()==null){
			this.setCcy("");
		}
		if(this.getJdbj()==null){
			this.setJdbj("");
		}
		if(this.getXzbz()==null){
			this.setXzbz("");
		}
		if(this.getJyje()==null){
			this.setJyje("");
		}
		if(this.getZhye()==null){
			this.setZhye("");
		}
		if(this.getZysm()==null){
			this.setZysm("");
		}
		
		return this.getJyrq()+this.getJysj()+this.getJyls()+this.getZhdh()+this.getZhmc()+this.getCcy()+this.getJdbj()+this.getXzbz()+
			this.getJyje()+this.getZhye()+this.getZysm();
	}

	public void parse(String str) throws Exception {
		if(str==null){
			Exception e=new Exception("String is null");
			throw e;
		}else if(str.getBytes("gbk").length<TOTAL_LEN){
			Exception e=new Exception("Invalid request");
			throw e;
		}else{
			this.setJyrq(SplitString.splitString(str,reallen,reallen+JYRQ_LEN));
			reallen += JYRQ_LEN;
			this.setJysj(SplitString.splitString(str,reallen,reallen+JYSJ_LEN));
			reallen += JYSJ_LEN;
			this.setJyls(SplitString.splitString(str,reallen,reallen+JYLS_LEN));
			reallen += JYLS_LEN;
			this.setZhdh(SplitString.splitString(str,reallen,reallen+ZHDH_LEN));
			reallen += ZHDH_LEN;
			this.setZhmc(SplitString.splitString(str,reallen,reallen+ZHMC_LEN));
			reallen += ZHMC_LEN;
			this.setCcy(SplitString.splitString(str,reallen,reallen+CCY_LEN));
			reallen += CCY_LEN;
			this.setJdbj(SplitString.splitString(str,reallen,reallen+JDBJ_LEN));
			reallen += JDBJ_LEN;
			this.setXzbz(SplitString.splitString(str,reallen,reallen+XZBZ_LEN));
			reallen += XZBZ_LEN;
			this.setJyje(SplitString.splitString(str,reallen,reallen+JYJE_LEN));
			reallen += JYJE_LEN;
			this.setZhye(SplitString.splitString(str,reallen,reallen+ZHYE_LEN));
			reallen += ZHYE_LEN;
			this.setZysm(SplitString.splitString(str,reallen,reallen+ZYSM_LEN));
			reallen += ZYSM_LEN;
		}
	}

}
